#include <stdio.h>
#include<math.h>

int main()
{

	int k ,num = 0;
	scanf("%d",&k);
	num = sqrt(2*k+0.25) - 0.5;
	printf("%d",num*(num+1)*(2*num+1)/6 + (num+1)* (k-(num+1)*num/2));
	return 0;

}